<template>
	<view class="wrap">
		<block v-if="isHasDataFlag">
			<child-list :recList="recList" currType="list"></child-list>
		</block>
		<block v-else-if="isHasDataFlag == false">
			<no-data :noDataTxt="noDataTxt"></no-data>
		</block>
	</view>
</template>

<script>
	import ChildList from './components/ChildList'
	import { getMyChilds } from '@/api/zhuxue'
	export default {
		components:{
			ChildList,
		},
		data() {
			return {
				noDataTxt:'暂无记录,请绑定',
				isHasDataFlag:null,
				recList:[],
			}
		},
		onLoad(){
			this.loadMyChilds();
		},
		methods: {
			loadMyChilds(){
				let field = { account:uni.getStorageSync('token') };
				let contentStr = this.crypto.encrypt(JSON.stringify( field )); 
				getMyChilds({content:contentStr}).then(res=>{
					this.isHasDataFlag = true;
					this.recList = res.data.datas;
				}).catch(err=>{
					this.isHasDataFlag = false;
					//console.log(err)
				});
			}
		}
	}
</script>
<style lang="scss">
	page{
		background: $pss-bg-primary;
	}
</style>
<style lang="scss" scoped>
	.stuTxt{
		color: $pss-color-primary_1;
	}
	.comBtn{
		background: $pss-color-blue;
	}
	.wrap{
		@include respTo(phone){
			padding: 30rpx 30rpx 0rpx;
		}
		@include respTo(pad){
			padding: 20rpx 20rpx 0rpx;
		}
	}
</style>
